<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
		<link href="__INDEX__/css/all.css" rel="stylesheet" />
		<link href="__INDEX__/css/sub-inquire.css" rel="stylesheet" />
		<link href="__INDEX__/css/detail.css" rel="stylesheet" />
		<link href="__INDEX__/css/mui.min.css" rel="stylesheet" />
		<link href="__INDEX__/css/Phoebe.css" rel="stylesheet" />
		<link href="__INDEX__/css/all.css" rel="stylesheet" />
		<link href="http://at.alicdn.com/t/font_r4hllapx8ijdobt9.css" rel="stylesheet" />
		<title>产品详情</title>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a href="javascript:history.back(-1)" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">产品详情</h1>
		</header>
		<!--产品详情-->
		<div class="product-detail">
			<h1>产品名称：<span id="gd_name">{$good['name']}</span></h1>
			<ul>
				<li>昨日成交均价：<span>{$avg_y}</span></li>
				<li>涨跌：<span>
						0</span></li>
				<li>涨跌幅：<span class="grow">0%</span></li>
			</ul>
		</div>
		<div class="money-list">
			<h2>用户出价记录</h2>
			<ul class="sub-inquire">
				<li>
					<a href="javascript:void(0)">
						<ul>
							<li style="width: 25%;">用户ID</li>
							<li style="width: 25%;">出价</li>
							<li style="width: 25%;">购买数量</li>
							<li style="width: 25%;">操作</li>
						</ul>
						{foreach name="orders" item="o"}
						<ul>
							<li style="width: 25%;float: left;text-align: center;">{$o.id}</li>
							<li style="width: 25%;float: left;text-align: center;">{$o.price}</li>
							<li style="width: 25%;float: left;text-align: center;">{$o.num}</li>
							<li style="width: 25%;float: left;text-align: center;">
								<button type="button" onclick="sell_gd('{$o.id}','{$o.num}','{$o.price}','{$o.goods_id}')" class="mui-btn mui-btn-link">
							出售</button></li>
						</ul>
						{/foreach}
					</a>
				</li>
			</ul>
		</div>
		<!--底部导航-->

		<nav class="mui-bar mui-bar-tab" id="footer-list">
			<a class="mui-tab-item" href="{:url('index/index')}">
				<span class="mui-icon iconfont icon-shouye"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item mui-active" href="{:url('index/market')}">
				<span class="mui-icon iconfont icon-heilongjiangtubiao09"></span>
				<span class="mui-tab-label">市场</span>
			</a>
			<a class="mui-tab-item" href="{:url('index/ck')}">
				<span class="mui-icon iconfont icon-cangku1"></span>
				<span class="mui-tab-label">持仓</span>
			</a>
			<a class="mui-tab-item " href="{:url('member/index')}">
				<span class="mui-icon iconfont icon-wode1"></span>
				<span class="mui-tab-label">我的</span>
			</a>
		</nav>

		<!--model-->
		<div class="my-modal">
			<div>
				<h2>成交确认</h2>
				<div>
					<p id="cx-proname">产品名称：<span id="goods_name"></span></p>
					<div>
						<ul>
							<li>出售价格：<span id="goods_price"></span></li>
							<li>
								出售数量<span id="sell_num"></span>
							</li>
							<li>成交金额：<span id="total_price"></span></li>
							<li>手续费：<span id="fee"></span></li>
						</ul>
					</div>
					<!--<p>需冻结资金不足，还差200.00 <a href=""> 立即充值</a></p>-->
					<div>
						<button class="sell_conf" onclick="confirm_sell()">确认</button>
						<button class="close_sell">取消</button>
					</div>
				</div>
			</div>
		</div>
		<input type="hidden" id="goods_id" />
		<input type="hidden" id="goods_num" />
		<input type="hidden" id="order_id" />
		<script src="js/mui.min.js"></script>
		<script src="/public/static/js/jquery.min.js"></script>
		<script src="/public/static/layui/layui.all.js"></script>
		<script type="text/javascript">
			var user_id='{$Think.session.uid}';
           // console.log(11);

		function sell_gd(id,num,price,goods_id){
			$("#goods_id").val(goods_id);
			$("#order_id").val(id);
			$("#goods_num").val(num);
			$(".my-modal").show();
			$("#goods_name").text($("#gd_name").text());
			$("#goods_price").text(price);
			$("#sell_num").text(num);
			$("#total_price").text(price*num);
		}
		function confirm_sell(){
			if(user_id==""||user_id==null){
        		layer.msg("请先登录", {
					icon: 1,
					time: 1000 //2秒关闭（如果不配置，默认是3秒）
				}, function() {
					location.href = "{:url('index/login')}";
				});
        	}else{
    		    $.ajax({
                    url: "{:url('index/sell_order')}",
                    data:{
                    	order_id:$("#order_id").val()
                    },
                    success:function ( data ) {
                    	$(".my-modal").hide();
                    	layer.msg(data.msg);
                    	if(data.code==200){
                    		location.href = "{:url('member/my_market')}";
                    	}
                    }
                })
        	}
		}
			$(".close_sell").click(function() {
				$(".my-modal").css("display", "none");
			})
		</script>
	</body>

</html>